{% extends "base.html" %}

{% block title %}OECH{% endblock %}

{% block page_content %}
    <div class="page-header">
        <h3>openEuler Hardware Compatibility Test</h3>
    </div>

    <table class="table table-striped table-hover">
        <tbody>
        {% for host, id_dict in results.items() %}
            <tr>
            <td>
            <div class="dropdown">
                <div class="dropdown-toggle" data-toggle="dropdown">
                    {{ host }} <span class="caret"></span>
                </div>
                <ul class="dropdown-menu">
                {% set use_divider = [] %}
                {% for id, job_list in id_dict.items() %}
                    {% if use_divider %}
                        <li class="divider"></li>
                        <!-- `set` do not support global varible
                         use `do` instead -->
                        {% do use_divider.pop() %}
                    {% endif %}

                    {% do use_divider.append(1) %}
                    <li class="dropdown-header">Test ID: {{ id }}</li>
                    {% for job in job_list %}
                        <li><a href="/results/{{ host }}/{{ id }}/{{ job }}">{{ job }}</a></li>
                    {% endfor %}
                {% endfor %}
                </ul>
            </div>
            </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}
